<template>
	<view class="my-search-container" :style="{'background-color':bgcolor }" @click="gotoSearch">
		<view class="my-search-box" :style="{'border-radius': radius +'px'  }">
			<uni-icons type="search" size="17"></uni-icons>
			<text class="placeholder">{{content}}</text>
		</view>		
	</view>
</template>

<script>
	export default {
		name:"my-search",
		props:{
			// 背景颜色
			bgcolor:{
				type:String,
				default:'#fff',
			},
			// 圆角尺寸
			radius:{
				type:Number,
				default:16  ,//px
			},
			// 搜索框里面的内容
			content:{
				type:String,
				default:'搜索商品',
			},
			
		},
		data() {
			return {
		
			};
		},
		methods:{
			// 给自定义的搜索组件绑定搜索事件
			gotoSearch(){
				uni.navigateTo({
					url:'/subpkg1/search/search',
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
.my-search-container{
	width: 250px;
	height:95%;
	display: flex;
	align-items: center;		
	border-radius: 18px;
	margin: 0 10px;
	margin-bottom: 10px;
	.my-search-box{
		height:36px;
		width: 100%;
		border-radius: 18px;
		display: flex;
		// justify-content: center;
		padding-left:8px;
		flex-direction: row;
		align-items: center;
		.placeholder{
			color:#ccc;
			font-size: 15px;
			margin-left: 6px;
			font-weight:400;
		}
	}
}
</style>